package gll.pub.onepeas.util

import org.springframework.http.HttpStatus
import org.springframework.http.ResponseEntity

class HttpResponseUtil {
    object response {
        fun<T> notFound(payload: T): ResponseEntity<Map<String, T>> {
            return ResponseEntity(mapOf("error" to payload),HttpStatus.NOT_FOUND)
        }
        fun ok (payload: Any): ResponseEntity<Any> {
            return ResponseEntity(BaseBean(data = payload),HttpStatus.OK)
        }
        fun fail (message: String): ResponseEntity<Any> {
            return ResponseEntity(BaseBean(code = 500, message = message),HttpStatus.OK)
        }
    }
}
data class BaseBean(val code:Int = 200, val message:String="success",val data:Any?=null)